from django.db import models


class BaseModel(models.Model):
    """ 基础模型类 """
    ext_1 = models.CharField(max_length=255, null=True, blank=True, verbose_name='扩展字段1')
    ext_2 = models.CharField(max_length=255, null=True, blank=True, verbose_name='扩展字段2')
    ext_3 = models.CharField(max_length=255, null=True, blank=True, verbose_name='扩展字段3')
    is_delete = models.BooleanField(default=False, verbose_name='删除标记')
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        abstract = True
        verbose_name = '基础模型类'
        verbose_name_plural = verbose_name


class StatusSortBaseModel(BaseModel):
    """ 状态和排序基础模型类 """
    status = models.BooleanField(default=True, verbose_name='状态')
    sort = models.IntegerField(default=0, verbose_name='排序')

    class Meta:
        abstract = True
        ordering = ['sort']
        verbose_name = '状态和排序基础模型类'
        verbose_name_plural = verbose_name
